package cn.cool.area;

import java.util.Scanner;
import java.util.Stack;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String s = scanner.next();
        Stack<Character> stack = new Stack<>();

        for (char c : s.toCharArray()) {
            if (!stack.isEmpty()) {
                char top = stack.peek();
                // 检查当前字符与栈顶字符之和是否为10
                if (Character.getNumericValue(c) + Character.getNumericValue(top) == 10) {
                    stack.pop(); // 消去栈顶字符
                    continue;
                }
            }
            stack.push(c); // 入栈
        }

        System.out.println(stack.size());
    }
}